import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/About.vue')
    }
  ]
})

router.afterEach((to, from) => {
  if (to.path == '/') {
    window.Telegram.WebApp.BackButton.hide();
  } else {
    window.Telegram.WebApp.BackButton.show();
  }
});

export default router
